﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/AdminMaster.Master"
    AutoEventWireup="true" CodeBehind="editBuySetting.aspx.cs" Inherits="whatpricemyhouse.Admin.editBuySetting" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p>
        1. Price Selecter</p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
            BorderWidth="1px" CellPadding="4" DataKeyNames="PRID" DataSourceID="LinqDataSource1"
            EnableModelValidation="True">
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="PRName" HeaderText="Name" SortExpression="PRName" />
                <asp:BoundField DataField="PRValue" HeaderText="Value" 
                    SortExpression="PRValue" />
                <asp:BoundField DataField="PRDesc" HeaderText="Desc" SortExpression="PRDesc" />
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
            ContextTypeName="whatpricemyhouse.LINQ.DataControllerDataContext" 
            EnableUpdate="True" TableName="price_range_tables">
        </asp:LinqDataSource>
    </p>
    <p>
        Add New:&nbsp;
    </p>
    <p>
        Name:
        <asp:TextBox ID="PRNameTxt" runat="server"></asp:TextBox>
        &nbsp;Value:<asp:TextBox ID="PRValueTxt" runat="server"></asp:TextBox>
        <asp:Label ID="ValueErrorLabel" runat="server" ForeColor="Red"></asp:Label>
        &nbsp; Description:<asp:TextBox ID="PRDescTxt" runat="server"></asp:TextBox>
        <asp:Button ID="PRAddButton" runat="server" OnClick="PRAddButton_Click" Text="Add" />
    </p>
    <p>
        <hr /></p>
    <p>
        2. Property Type</p>
    <p>
        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
            BorderWidth="1px" CellPadding="4" DataKeyNames="PTID" DataSourceID="SqlDataSource2"
            EnableModelValidation="True">
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="PTName" HeaderText="Name" SortExpression="PTName" />
                <asp:BoundField DataField="PTDesc" HeaderText="Desc" SortExpression="PTDesc" />
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        </asp:GridView>
    </p>
    <p>
        Add new:</p>
    <p>
        Name:
        <asp:TextBox ID="PTNameTxt" runat="server"></asp:TextBox>
        &nbsp;Desc:
        <asp:TextBox ID="PTDescTxt" runat="server"></asp:TextBox>
        &nbsp;<asp:Button ID="PTAddButton" runat="server" OnClick="PTAddButton_Click" Text="Add" />
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>"
            DeleteCommand="DELETE FROM [property_type_table] WHERE [PTID] = @PTID" 
            InsertCommand="INSERT INTO [property_type_table] ([PTID], [PTName], [PTDesc]) VALUES (@PTID, @PTName, @PTDesc)"
            SelectCommand="SELECT * FROM [property_type_table] ORDER BY [PTName]" 
            UpdateCommand="UPDATE [property_type_table] SET [PTName] = @PTName, [PTDesc] = @PTDesc WHERE [PTID] = @PTID">
            <DeleteParameters>
                <asp:Parameter Name="PTID" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="PTID" Type="String" />
                <asp:Parameter Name="PTName" Type="String" />
                <asp:Parameter Name="PTDesc" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="PTName" Type="String" />
                <asp:Parameter Name="PTDesc" Type="String" />
                <asp:Parameter Name="PTID" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        <hr /></p>
    <p>
        3. When To buy</p>
    <p>
        <asp:GridView ID="GridView3" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="WTBID" DataSourceID="SqlDataSource3"
            EnableModelValidation="True" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="WTBName" HeaderText="Name" SortExpression="WTBName" />
                <asp:BoundField DataField="WTBDesc" HeaderText="Desc" SortExpression="WTBDesc" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        </asp:GridView>
    </p>
    <p>
        Add New:</p>
    <p>
        Name:
        <asp:TextBox ID="WTBNameTxt" runat="server"></asp:TextBox>
        &nbsp;Desc:
        <asp:TextBox ID="WTBDescTxt" runat="server"></asp:TextBox>
        &nbsp;<asp:Button ID="WTBAddButton" runat="server" OnClick="WTBAddButton_Click" Text="Add" />
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>"
            DeleteCommand="DELETE FROM [when_to_buy] WHERE [WTBID] = @original_WTBID AND (([WTBName] = @original_WTBName) OR ([WTBName] IS NULL AND @original_WTBName IS NULL)) AND (([WTBDesc] = @original_WTBDesc) OR ([WTBDesc] IS NULL AND @original_WTBDesc IS NULL))"
            InsertCommand="INSERT INTO [when_to_buy] ([WTBID], [WTBName], [WTBDesc]) VALUES (@WTBID, @WTBName, @WTBDesc)"
            OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [when_to_buy]"
            UpdateCommand="UPDATE [when_to_buy] SET [WTBName] = @WTBName, [WTBDesc] = @WTBDesc WHERE [WTBID] = @original_WTBID ">
            <DeleteParameters>
                <asp:Parameter Name="original_WTBID" Type="String" />
                <asp:Parameter Name="original_WTBName" Type="String" />
                <asp:Parameter Name="original_WTBDesc" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="WTBID" Type="String" />
                <asp:Parameter Name="WTBName" Type="String" />
                <asp:Parameter Name="WTBDesc" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="WTBName" Type="String" />
                <asp:Parameter Name="WTBDesc" Type="String" />
                <asp:Parameter Name="original_WTBID" Type="String" />
                <asp:Parameter Name="original_WTBName" Type="String" />
                <asp:Parameter Name="original_WTBDesc" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        <hr /></p>
    <p>
        4. Loan information</p>
    <p>
        <asp:GridView ID="GridView4" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
            BorderWidth="1px" CellPadding="4" DataKeyNames="LTID" DataSourceID="SqlDataSource4"
            EnableModelValidation="True">
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="LTName" HeaderText="Name" SortExpression="LTName" />
                <asp:BoundField DataField="LTDesc" HeaderText="Desc" SortExpression="LTDesc" />
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        </asp:GridView>
    </p>
    <p>
        Add new:</p>
    <p>
        Name:<asp:TextBox ID="LTNameTxt" runat="server"></asp:TextBox>
        &nbsp;Desc:
        <asp:TextBox ID="LTDescTxt" runat="server"></asp:TextBox>
        &nbsp;<asp:Button ID="LTAddButton" runat="server" OnClick="LTAddButton_Click" Text="Add" />
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>"
            DeleteCommand="DELETE FROM [loan_type_table] WHERE [LTID] = @original_LTID AND (([LTName] = @original_LTName) OR ([LTName] IS NULL AND @original_LTName IS NULL)) AND (([LTDesc] = @original_LTDesc) OR ([LTDesc] IS NULL AND @original_LTDesc IS NULL))"
            InsertCommand="INSERT INTO [loan_type_table] ([LTID], [LTName], [LTDesc]) VALUES (@LTID, @LTName, @LTDesc)"
            OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [loan_type_table]"
            UpdateCommand="UPDATE [loan_type_table] SET [LTName] = @LTName, [LTDesc] = @LTDesc WHERE [LTID] = @original_LTID ">
            <DeleteParameters>
                <asp:Parameter Name="original_LTID" Type="String" />
                <asp:Parameter Name="original_LTName" Type="String" />
                <asp:Parameter Name="original_LTDesc" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="LTID" Type="String" />
                <asp:Parameter Name="LTName" Type="String" />
                <asp:Parameter Name="LTDesc" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="LTName" Type="String" />
                <asp:Parameter Name="LTDesc" Type="String" />
                <asp:Parameter Name="original_LTID" Type="String" />
                <asp:Parameter Name="original_LTName" Type="String" />
                <asp:Parameter Name="original_LTDesc" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
